-- 技能标题tips

local newSkillTitleTipsView = class("newSkillTitleTipsView",function()
    return ccui.Layout:create()
end)

function newSkillTitleTipsView:ctor()
    local function createModuleNode(uiPath, uiNodeName, parent)
        local node = cc.uiloader:load( uiPath )
        local moduleNode = node:getChildByName( uiNodeName )
        moduleNode:retain()
        moduleNode:removeFromParent()
        parent:addChild( moduleNode )
        moduleNode:release()
        return moduleNode
    end
    self.mUINode = createModuleNode( Res.Tips_SkillTitle, "Tips_skill", self )
    self:setContentSize( self.mUINode:getContentSize() )

    ccui.Helper:doLayout( self.mUINode )

    self._skillName = self.mUINode:getChildByName( "Name" ) -- 技能名字
    self._skillType = self.mUINode:getChildByName( "type" ) -- 技能定位
    self._skillType:setVisible( false )

    local skillIconPanel = self.mUINode:getChildByName( "Panel_skill" )
    self._skillBg = skillIconPanel:getChildByName( "bg" ) -- 技能底图
    self._skillIcon = skillIconPanel:getChildByName( "icon" ) -- 技能底图
end

-- data = battleSkillConf
function newSkillTitleTipsView:refreshContent( battleSkill )
    self._skillName:setString( L(battleSkill:getName()) )
    local iconPath = battleSkill:getIcon()
    if string.find( iconPath, "art/" ) then -- 兼容已经格式化好的icoPath
        self._skillIcon:loadTexture( battleSkill:getIcon() )
    else
        self._skillIcon:loadTexture(GD:getImagePath(Res.skillIconPath,battleSkill:getIcon()))
    end
end

-- data = Skill
function newSkillTitleTipsView:refreshClassSkillContent( skill )
    self._skillName:setString( L(skill:getName()) )
    self._skillIcon:loadTexture(skill:getIcon())
end

return newSkillTitleTipsView
